<template>
  <!-- 方法一 -->
  <!-- <p :style="{ color: theme }">hello</p> -->
  <p>hello</p>
</template>

<script setup lang="ts">
import { ref } from "vue"
const theme = ref("red")

const colors = ["blue", "yellow", "red", "green"]

setInterval(() => {
  theme.value = colors[Math.floor(Math.random() * 4)]
}, 1000)

</script>

<style scoped>
/* 修改以下代码绑定动态颜色 */
p {
  /* color: red */
  color: v-bind(theme);
}
</style>